package com.example;

import java.util.Arrays;

public class Demo01 {
    public static void main(String[] args) {
        /* 调用Book类的空参构造方法，创建一个对象，命名为book */
        Book book = new Book();
        book.setBookName("《三国演义》");
        book.setAuthor("罗贯中");
        book.setPrice(99.9);
        /* 调用Book类的带参数构造方法，创建对象 */
        Book book1 = new Book("《水浒传》",
                "施耐庵",
                99.9,
                200,
                "v1.1");
        System.out.println(book1.toString());

        int[] arr1;
        /* 类作为数据类型，这种叫做引用数据类型 */
        String s = "123";
        String[] arr2 = {"123", "456", new String("123456")};
        Book[] books = new Book[5];
        books[0] = book;
        books[1] = book1;
        books[2] = book1;
        books[3] = book;
        System.out.println(Arrays.toString(books));
    }
}
